Ext.define('Sencha.controller.DictionaryDetailController', {
    extend: 'Ext.app.Controller',

    config: {
        refs: {
            main: 'dictionarysourcenavigationview',
            //newDictionaryEntryButton: 'button[cls=addDictionaryEntryButton]',
            dictionaryDetailPanel: 'dictionarytargetdetailview',
            //editDictionaryEntryButton: 'button[text="EDIT"]'
        },
        control: {
            'dictionaryDetailPanel' :{
           		//initialize: 'onShowDictionaryDetailView'
            }/*,
            'editDictionaryEntryButton' :{
           		tap: 'editDictionary'
            }
            */
        }
    },

    // Create edit button on initialize
    onShowDictionaryDetailView : function() {
        console.log("in onPainted!!!!!!!!");
        //this.getEditDictionaryEntryButton().show();
        /*
        this.getMain().getNavigationBar().add({
            xtype   : 'button',
            text    : 'EDIT',
            align 	: 'right',
            cls		: 'editDictionaryButton'
        });
        */
    },
    
    //showing edit form for dictionary
   	editDictionary : function(){
        console.log("editDictionary...");
        
        //var bar = this.getMain().getNavigationBar();
        //this.getNewDictionaryButton().hide();
        this.getEditDictionaryEntryButton().setText('DONE');
        
        /*
        bar.add({
            xtype   : 'button',
            text    : 'EDIT',
            id      : 'editDictionaryButton',
            align 	: 'right',
            cls		: 'editDictionaryButton'
        });
        */
        
    	this.getMain().push({
    		title: 'Second',
    		xtype: 'dictionaryformview'			                    
        });
   	},
});
